import 'package:json_annotation/json_annotation.dart';

part 'regions.g.dart';

@JsonSerializable()
class Regions {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'value')
  String value;

  @JsonKey(name: 'latitude')
  String latitude;

  @JsonKey(name: 'longitude')
  String longitude;

  @JsonKey(name: 'code')
  String code;

  @JsonKey(name: 'childs')
  List<Regions> childs;

  @JsonKey(name: 'adcode')
  String adcode;

  Regions(
    this.id,
    this.value,
    this.childs,
    this.latitude,
    this.longitude,
    this.code,
    this.adcode,
  );

  factory Regions.fromJson(Map<String, dynamic> srcJson) =>
      _$RegionsFromJson(srcJson);

  Map<String, dynamic> toJson() {
    return _$RegionsToJson(this);
  }
}
